package com.shy.springframework.context.support;

import com.shy.springframework.beans.BeansException;
import com.shy.springframework.beans.factory.support.DefaultListableBeanFactory;
import com.shy.springframework.beans.factory.xml.XmlBeanDefinitionReader;

/**
 * @author yzpang
 * @desc:
 * @date: 2023/2/8 13:06
 */
public abstract class AbstractXmlApplicationContext extends AbstractRefreshableApplicationContext{

    @Override
    protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws BeansException {
        XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory, this);
        String[] configLocation = getConfigLocation();
        if (configLocation != null){
            beanDefinitionReader.loadBeanDefinitions(configLocation);
        }
    }

    protected abstract String[] getConfigLocation();
}
